package com.college.heyuhua.controllers;

import com.college.heyuhua.entity.UserInfo;
import com.college.heyuhua.service.IUserLogin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.logging.Logger;

/**
 * Created by 赵东坡 on 2018/12/30.
 * Time:15:52
 * 宇宙无敌赵牛逼，祈求永无bug
 */
@Controller
@RequestMapping("/login")
public class LoginController {

    private static Logger logger = Logger.getLogger("LoginController.class");

    @Autowired
    private IUserLogin iUserLogin;

    @RequestMapping("/userlogin")
    public String userlogin(@RequestParam("username") String username,
                            @RequestParam("password") String password,
                            ModelMap map) {

        logger.info("【/userlogin】"+"username:"+username+"password:"+password);
        UserInfo userInfo = new UserInfo();

        if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
            return "redirect";
        }

        userInfo.setUsername(username);
        userInfo.setPassword(Integer.parseInt(password));
        UserInfo userInfo1 = iUserLogin.findOne(userInfo);
        if(userInfo1!=null){


        }
        return "redirect";
    }




}
